<div class="page-content page-blog">
<ul class="blog-row">
<!-- // -->
    <?php
    $count = 0;
    foreach ($products as $product) {
        ?>
        <li class="blog-row-item">
            <div class="blog-row-item-t">
                <div class="blog-row-item-tt">
                    <a href="/item/<?php echo $product->id?>" class="blog-row-image"><img src="<?php echo $images[$count]->url?>" alt="" style="height: 230px; "/></a>

                    <div class="blog-row-content" style="padding: 22px 6px 1px 10px">
                        <div class="blog-row-content-a"><a href="/item/<?php echo $product->id?>"><?php echo $product->name ?></a></div>
                        <div class="post-likes" style="margin-top: -30px; margin-left: 5px;">
                            <span >$<?php echo $product->price ?></span>
                        </div>
                    </div>
                </div>
            </div>
        </li>
    <?php
        $count++;
    }

    ?>


</div>
<div>
    <style type="text/css">
        .navi{
            position: fixed; opacity: 0.9; bottom: 0px; width: 100%; height: 65px; z-index: 99; padding-top: 20px; padding-left: 20px;;
            background: #ffffff;
        }
        .navi:hover{
            opacity: 1;
        }
    </style>
    <div class="navi">
        <a class="btn-small" onclick="goback()">BACK to cart</a>
        <span style="float: right; right: 0px; position: fixed; margin-right: 20px;">
            <a class="btn-small" style="background: green; color: #ffffff; border-bottom: hidden" onclick="checkout()">$<span id="total"><?php echo $total?></span> TOTAL</a>
            <a class="btn-small" onclick="checkout()" ><img hidden="hidden" src="/public/home/img/loading.gif" style="width: 20px; margin: -5px 5px -5px -10px; " id="loading"/><span id="ck">Checkout</span></a>
        </span>
    </div>
</div>

<div></div>
<script>
    var goback = function(){
        location.href = '/cart';
    };
    var removeProduct = function(pid,e){
        $.post('/purchase/remove_item',{pid:pid})
            .done(function(data){
                if (data==1){
                    $(e).text('REMOVED');
                    setTimeout(function(){
                        location.reload();
                    },1000);
                }
            })
    };

    var checkout = function(){
        $('#loading').fadeIn();
        $('#ck').text('Purchasing');
        $.post('/purchase/checkout_step2',{pids: '<?php echo $pids ?>',total: <?php echo $total?>})
            .done(function(data){
                if (data==1){
                    setTimeout(function(){
                        location.href='http://localhost/purchase/checkout_paypal'
                    },2000);
                }
        })

    };



</script>